﻿<?xml version="1.0" encoding="utf-8" ?>
<Feature id="Articles" name="Articles Configuration">
	<Dependencies>
		<Dependency type="binary">ScsCore.dll</Dependency>
		<Dependency type="feature">BaseFrameworkFeature.xml</Dependency>
	</Dependencies>
	<Catalogs>
		<Entry >Articles</Entry>
		<Entry>ArticlesAdmin</Entry>
	</Catalogs>
	<BusinessRules>
		<BusinessRule name="postExtendsGetLimitsDisplayTemplate" security="disabled" postExtends="getLimitsDisplayTemplate">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleIdFromUniqueTitle" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleParents" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticles" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleCount" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getChunkOfArticles" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticlesFromUserMessages" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticlesByUniqueName" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticlesByRootId" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getAllCompanyArticles" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getAllCompanyArticlesForParent" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="searchCompanyArticlesForParent" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getYellowPagesCatagories" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>


		<BusinessRule name="getArticleIdTitleDetail" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleDetail" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleAppFunctions" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleTemplate" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getBlogDisplayTypes" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleDisplayTypes" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleMetaTypes" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
	</BusinessRules>

	<BusinessRules>
		<BusinessRule name="checkForAssociatedArticleCreateIfNeeded" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticlesAssociatedWithId" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="addAssociationToArticle" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="removeAssociationToArticle" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="removeAllAssociationsToArticle" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getAllAssociationsToArticle" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="createArticleAssociation" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getRootAssociatedArticleId" security="disabled">
			<LocalClass name="Articles.ArticleAssociationBizRules,ScsCore" />
		</BusinessRule>
	</BusinessRules>

	<BusinessRules>
		<!-- Calendar Support BizRules-->
		<BusinessRule name="getArticleSetUpdateDates" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getArticleSetUpdateDetailsDates" security="disabled">
			<LocalClass name="Articles.ArticlesBizRule,ScsCore" />
		</BusinessRule>
	</BusinessRules>

  <BusinessRules>
    <BusinessRule name="getCompanyRssChannels" security="disabled">
      <LocalClass name="Articles.ArticleRssBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="updateCompanyRssChannel" security="disabled">
      <LocalClass name="Articles.ArticleRssBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="deleteCompanyRssChannel" security="disabled">
      <LocalClass name="Articles.ArticleRssBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="getRssLeafNodeOptions" security="disabled">
      <LocalClass name="Articles.ArticleRssBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="getArticleRss" security="disabled">
      <LocalClass name="Articles.ArticleRssBizRules,ScsCore" />
    </BusinessRule>
  </BusinessRules>

  <BusinessRules>
    <BusinessRule name="updateUserArtFormData" security="disabled">
      <LocalClass name="Articles.ArtFormBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="getUserArtFormData" security="disabled">
      <LocalClass name="Articles.ArtFormBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="getUserArtFormResponses" security="disabled">
      <LocalClass name="Articles.ArtFormBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="deleteUserArtFormResponse" security="disabled">
      <LocalClass name="Articles.ArtFormBizRules,ScsCore" />
    </BusinessRule>
    <BusinessRule name="addSpecificArtFormNotifications" security="disabled" postExtends="getNotificationEvents">
      <LocalClass name="Articles.ArtFormBizRules,ScsCore" />
    </BusinessRule>
  </BusinessRules>

  <BusinessObjects>
		<BusinessObject type="TranslationDetails" key="transId">
			<Field name="transId" type="Guid" />
			<Field name="ud" type="Date" />
			<Field name="uUser" type="Guid" />
		</BusinessObject>
		
		<BusinessObject type="TranslatedValue" key="transId">
			<Field name="transId" type="Guid" />
			<Field name="val" type="String" />
		</BusinessObject>

	  <BusinessObject type="ArticleAssociation" key="name">
		  <Field name="name" type="String" />
		  <Field name="count" type="Integer" />
		  <Field name="items" type="List(Article)" />
	  </BusinessObject>

    <BusinessObject type="ArticleView" key="id">
      <Field name="id" type="Guid" />
      <Field name="sessionId" type="String" />
      <Field name="time" type="Date" />
    </BusinessObject>
		
		<BusinessObject type="Picture" key="id">
			<Field name="id" type="Guid" />
			<Field name="albumId" type="Guid" />
			<Field name="pictPosition" type="Integer" />
			<Field name="dateCreated" type="Date" />
			<Field name="dateUpdated" type="Date" />
			<Field name="name" type="String" />
			<Field name="title" type="String" />
			<Field name="caption" type="String" />
			<Field name="fileName" type="String" />
			<Field name="comments" type="String" />
			<Field name="viewCount" type="Integer" />
			<Field name="height" type="Integer" />
			<Field name="width" type="Integer" />
			<Field name="rating1" type="Integer" />
			<Field name="rating2" type="Integer" />
			<Field name="rating3" type="Integer" />
			<Field name="rating4" type="Integer" />
			<Field name="rating5" type="Integer" />
			<Method name="totalVotes" language="jscript.NET">
				<![CDATA[
        return (self.getItem("rating1") + 
               self.getItem("rating2") +
               self.getItem("rating3") +
               self.getItem("rating4") +
               self.getItem("rating5"))
        ]]>
			</Method>
			<Method name="averageRating" language="jscript.NET">
				<![CDATA[
        if(self.getItem("totalVotes") == 0)
          return 0;
        var t = (self.getItem("rating1") + 
               (self.getItem("rating2")*2) +
               (self.getItem("rating3")*3) +
               (self.getItem("rating4")*4) +
               (self.getItem("rating5")*5));
        return (t/ self.getItem("totalVotes")).toFixed(2);
        ]]>
			</Method>
		</BusinessObject>

		<BusinessObject type="Article" key="id" extends="TreeNode" >
			<Field name="subMetaType" type="String" />
			<Method name="metaType" language="jscript.NET"><![CDATA[
				var st = self.getItem("subMetaType");
				if(Cmn.IsEmpty(st))
					st = "General";
				return "Article/" + st;
			]]></Method>
			<Method name="name" language="jscript.NET"><![CDATA[return self.getItem("title");]]></Method>
			<Field name="isSystem" type="Boolean" />
			<Field name="keyword" type="String" />
			<Field name="baseTitle" type="String" />
			<Field name="baseBody" type="String" />
			<Field name="baseSummary" type="String"  validator="length &lt;= 1250" />
			<Field name="baseCaption" type="String" />
			<Field name="translatedBodies" type="List(TranslatedValue)" />
			<Field name="translatedTitles" type="List(TranslatedValue)" />
			<Field name="translatedSummaries" type="List(TranslatedValue)" />
			<Field name="translatedCaptions" type="List(TranslatedValue)" />
			<Field name="translationDetails" type="List(TranslationDetails)" />
			<Field name="primaryPicture" type="Picture" />
			<Field name="mediaCacheName" type="String" />
			<Field name="uniqueTitle" type="String" />
			<Field name="publishAuthorName" type="String" />
			<Field name="publishDate" type="Date" />
			<Field name="readMoreJump" type="String" />
			<Field name="associations" type="List(ArticleAssociation)" />
			<Field name="suggestedDisplayType" type="String" />

			<Method name="authorDisplayName" language="jscript.NET">
				<Get><![CDATA[
				var name = self.getItem("publishAuthorName");
				if(Cmn.IsEmpty(name))
					name = self.getItem("counts.author.userName");
				return name;
			]]></Get>
				<Set>
				<![CDATA[self.put("publishAuthorName",val);]]>
				</Set>
			</Method>

			<Method name="dbPublishDate" language="jscript.NET">
				<Get>
					<![CDATA[
				var pd = self.getItem("publishDate");
				if(pd == null || pd == DateTime.MinValue || pd == DateTime.MaxValue)
					pd = null;
				return pd;
			]]>
				</Get>
				<Set>
					<![CDATA[
					self.put("publishDate",val);
					]]>
				</Set>
			</Method>

			<Method name="publishEditDisplayDate" language="jscript.NET">
				<Get>
				<![CDATA[
				var pd = self.getItem("publishDate");
				if(pd == null || pd == DateTime.MinValue || pd == DateTime.MaxValue)
					pd = "";
				return pd;
			]]>
				</Get>
				<Set>
					<![CDATA[
					self.put("publishDate",val);
					]]>
				</Set>
			</Method>

			<Method name="publishDisplayDate" language="jscript.NET">
				<![CDATA[
				var pd = self.getItem("publishDate");
				if(pd == null || pd == DateTime.MinValue || pd == DateTime.MaxValue)
					pd = self.getItem("counts.dateUpdated");
        return Swaf.Container.DateFormattingNode.FormatDate(pd, "easy", true);
			]]>
			</Method>

			<Method name="moreLink" language="jscript.NET"><![CDATA[return "Read More";]]></Method>

			<Method name="uniqueId" language="jscript.NET">
				<![CDATA[
				var x = self.getItem("uniqueTitle");
				var i = self.getItem("id");
				return Cmn.IsEmpty(x)?i==null?null:i.ToString():x;
			]]>
			</Method>
			<Method name="body" language="jscript.NET">
				<Get>
					<![CDATA[
					if (!app.resMgr.UsingBuiltInCulture)
					{
						var c = app.resMgr.CurrentCulture;
						var id = c.getItem("translationId");
						var list = self.getItem("translatedBodies");
						var obj = list.search("transId",id);
						if(obj!=null)
							return obj.getItem("val");
					}
					return self.getItem("baseBody");
				]]>
				</Get>
				<Set>
					<![CDATA[
					if (!app.resMgr.UsingBuiltInCulture)
					{
						var c = app.resMgr.CurrentCulture;
						var id = c.getItem("translationId");
						var list = self.getItem("translatedBodies");
						var obj = list.search("transId",id);
						if(obj!=null)
							return obj.put("val",val);
					}
					return self.put("baseBody",val);
				]]>
				</Set>
			</Method>
			<Method name="summary" language="jscript.NET">
				<Get>
					<![CDATA[
					if (!app.resMgr.UsingBuiltInCulture)
					{
						var c = app.resMgr.CurrentCulture;
						var id = c.getItem("translationId");
						var list = self.getItem("translatedSummaries");
						var obj = list.search("transId",id);
						if(obj!=null)
							return obj.getItem("val");
					}
					return self.getItem("baseSummary");
				]]>
				</Get>
				<Set>
					<![CDATA[
					if (!app.resMgr.UsingBuiltInCulture)
					{
						var c = app.resMgr.CurrentCulture;
						var id = c.getItem("translationId");
						var list = self.getItem("translatedSummaries");
						var obj = list.search("transId",id);
						if(obj!=null)
							return obj.put("val",val);
					}
					return self.put("baseSummary",val);
				]]>
				</Set>
			</Method>
			<Method name="title" language="jscript.NET">
				<Get>
					<![CDATA[
					if (!app.resMgr.UsingBuiltInCulture)
					{
						var c = app.resMgr.CurrentCulture;
						var id = c.getItem("translationId");
						var list = self.getItem("translatedTitles");
						var obj = list.search("transId",id);
						if(obj!=null)
							return obj.getItem("val");
					}
					return self.getItem("baseTitle");
				]]>
				</Get>
				<Set>
					<![CDATA[
					if (!app.resMgr.UsingBuiltInCulture)
					{
						var c = app.resMgr.CurrentCulture;
						var id = c.getItem("translationId");
						var list = self.getItem("translatedTitles");
						var obj = list.search("transId",id);
						if(obj!=null)
							return obj.put("val",val);
					}
					return self.put("baseTitle",val);
				]]>
				</Set>
			</Method>			
			<Field name="languageId" type="String" />
			<Field name="bodyTranslation" type="String" />
			<Field name="summaryTranslation" type="String" />
			<Field name="titleTranslation" type="String" />
			<Field name="captionTranslation" type="String" />
			<Field name="translationId" type="Guid"><NULL/></Field>
			<Field name="companyId" type="Guid"><NULL/></Field>
		</BusinessObject>

		<BusinessObject type="ArticleAppFunction" extends="DynamicAppFunction" key="id">
			<Field name="isArticle" type="Boolean">True</Field>
		</BusinessObject>

		<BusinessObject injects="UserLimits">
			<Field name="maxTotalArticles" type="Integer" />
			<Field name="currentArticleCount" type="BigInteger" />
			<Field name="maxTotalArticleSize" type="BigInteger" />
		</BusinessObject>
		
		<BusinessObject injects="CompanyLimits">
			<Field name="maxTotalArticles" type="Integer" />
			<Field name="currentArticleCount" type="BigInteger" />
			<Field name="maxTotalArticleSize" type="BigInteger" />
		</BusinessObject>
		
		<BusinessObject type="ArticleType" key="id">
			<Field name="id" type="String" />
			<Field name="name" type="String" />
		</BusinessObject>
		
		<BusinessObject type="YouTubeArticleGenParams" key="id">
			<Field name="id" type="Integer" />
			<Field name="youTubeAccountName" type="String"/>
			<Field name="baseArticleUniqueName" type="String" />
		</BusinessObject>

		<BusinessObject type="RssFeed" key="id">
			<Field name="id" type="Guid" />
			<Field name="companyId" type="Guid" />
			<Field name="rootArticle" type="Article" />
			<Field name="includePodCastAttribs" type="Boolean" />
      <Field name="useBodyAsDescription" type="Boolean" />
      <Field name="useLastUpdateAsFeedDate" type="Boolean" />
			<Field name="entireTree" type="Boolean" />
			<!-- leafNodes defines what articles in the rootArticle tree of articles should actually be include.
					0 - Do not include leaf nodes.  The rss feed will only contain interior nodes.
					1 - Include leaf nodes.  the rss feed will contain all of the articles in the rootArticle tree.
					2 - Only leaf nodes.  The rss feed will not contain interior nodes -->
			<Field name="leafNodes" type="Integer" />
		</BusinessObject>

		<BusinessObject type="RssLeafNodeOption" key="id">
			<Field name="id" type="Integer" />
			<Field name="title" type="String" />
		</BusinessObject>

    <BusinessObject type="ArticleForm" key="id">
      <Field name="id" type="Guid" />
      <Field name="lastUpdated" type="Date" />
      <Field name="article" type="Article" />
      <Field name="user" type="User" />
		<Field name="form" type="Object" />
      <Field name="formData" type="String" />
    </BusinessObject>
	</BusinessObjects>

	<ApplicationFunctions id="GetArticles" description="General Article Management">
		<AppFunction id="ManageArticles" description="Manage Site Articles" />
		<AppFunction id="ManageSystemArticles" description="Manage Site System Articles" />
		<AppFunction id="ReparentArticles" description="Move an article to a different part of the article tree." />
		<AppFunction id="SetAsSiteGroup" description="Set Article as Public" />
	</ApplicationFunctions>
	<ApplicationFunctions id="Articles" description="Article Book Access">
		<DynamicAppFunction id="ArticleAppFunctions" bizrule="getArticleAppFunctions" bizobjType="ArticleAppFunction" scope="companyId"/>
	</ApplicationFunctions>


	<ApplicationData>
		<Entry name="ArticleMetaTypes" type="IBizObjList.ArticleType">
			<ArticleTypes>
				<ArticleType id="General" name="General Article" />
				<ArticleType id="Blog" name="Blog" />
				<ArticleType id="Forum" name="Forum" />
				<ArticleType id="PhotoAlbum" name="Photo Album" />
				<ArticleType id="ArtForm" name="User Form" />
				<ArticleType id="News" name="News" />
				<ArticleType id="Comment" name="User Comment" />
			</ArticleTypes>
		</Entry>
		<Entry name="ArticleDisplayTypes" type="IBizObjList.ArticleType">
			<ArticleTypes>
				<ArticleType id="" name="- Default -" />
				<ArticleType id="-Book" name="Book" />
        <ArticleType id="-Book-WithMainStory" name="Full Book" />
        <ArticleType id="-Book-1TitleBody2MainStory" name="Book w/Body &amp; Full Child" />
        <ArticleType id="-FlowingChildren" name="Two Column Children" />
        <ArticleType id="-News" name="News" />
				<ArticleType id="-PhotoAlbum" name="Photo Album - Title, Body, Children" />
				<ArticleType id="-PeopleGroup-PeopleImg-TitleChildrenBody" name="People Group - Title, People List w/Img, Body" />
				<ArticleType id="-PeopleGroup-PeopleNoImg-TitleChildrenBody" name="People Group - Title, People List no Img, Body" />
				<ArticleType id="-NoAuthor" name="Basic Article w/Summary" />
				<ArticleType id="-NewsLink" name="News Link" />
				<ArticleType id="-Outline" name="Outline" />
				<ArticleType id="-ImageSummaryBody" name="Title, Image, Summary and Body" />
				<ArticleType id="-Simple" name="Title and Body Only" />
				<ArticleType id="-YPTitleSummaryBody" name="Yellow Page Style 1" />
				<ArticleType id="-YPImageSummaryBody" name="Yellow Page Style 2" />
        <ArticleType id="-ArtForm" name="User Form" />
			</ArticleTypes>
		</Entry>
		<Entry name="RssLeafNodeOptions" type="IBizObjList.RssLeafNodeOption">
			<RssLeafNodeOptions>
				<RssLeafNodeOption id="0" title="Do not include leaf nodes" />
				<RssLeafNodeOption id="1" title="Include leaf nodes" />
				<RssLeafNodeOption id="2" title="Only include leaf nodes" />
			</RssLeafNodeOptions>
		</Entry>
		<Entry name="articleOptions" type="Swaf.Container.FlexiMap" />
		<Entry name="articleOptions.rootCacheName" type="String">syrinxdevcomimages</Entry>
		<Entry name="ArticleParentDropDown-Root" type="IBizObj.Article">
			<Article id="5E6E3D6B-65B0-4e08-95CA-7720DCDE3E2E" baseTitle="- No Parent -" />
		</Entry>

		<Entry name="filterSortOptions.fol" type="IBizObj.FilterSortOptions">
			<FilterSortGroupConfig id="">
				<fieldOptions>
					<FilterFieldOptions name="Title" value="a.baseTitle" defaultEditor="combo(getEntryDescriptions,name,name)">
						<criterias>
							<CriteriaConfig name="Contains" value="c" editor="dropdown" />
							<CriteriaConfig name="Starts With" value="s" editor="dropdown" />
							<CriteriaConfig name="Ends With" value="e" editor="dropdown" />
						</criterias>
					</FilterFieldOptions>
					<FilterFieldOptions name="Summary" value="a.baseSummary" defaultEditor="combo(getEntryDescriptions,name,name)">
						<criterias>
							<CriteriaConfig name="Contains" value="c" editor="dropdown" />
							<CriteriaConfig name="Starts With" value="s" editor="dropdown" />
							<CriteriaConfig name="Ends With" value="e" editor="dropdown" />
						</criterias>
					</FilterFieldOptions>
				</fieldOptions>
			</FilterSortGroupConfig>
		</Entry>

    <Entry name="notificationEvents.ArtFormDataSubmited" type="System.Boolean">true</Entry>
  </ApplicationData>
	<DarExtensions from="Articles" for="UserLogin" />

	<ClassFactory id="BizProcs">
		<Class type="Articles.Gui.ArticleManagementBizProc,ScsCore" name="genericArticles"/>
		<Class type="Articles.Gui.ArticleTranslationBizProc,ScsCore" name="articleTranslations"/>
		<Class type="Articles.Gui.ArticleTrailBizProc,ScsCore" name="articleTrail"/>
		<Class type="Articles.Gui.ArticleUserMessengerBizProc,ScsCore" name="messenger"/>
		<Class type="Articles.Gui.RssChannelsBizProc,ScsCore" name="rssChannels"/>
	    <Class type="Articles.Gui.UserResponseManagementBizProc,ScsCore" name="userResponses"/>
  </ClassFactory>

	<ClassFactory id="MacroFunctions">
		<Class name="CalcPageName" type="Syrinx.PageNameCalculator,ScsCore" />
		<Class name="CalcArticleIds" type="Articles.ArticleIdsMacro,ScsCore" />
	</ClassFactory>

	<ClassFactory id="ArtFormValidators">
		<Class name="greaterThan" type="Articles.FieldLengthValidator,ScsCore" />
		<Class name="email" type="Articles.EmailValidator,ScsCore" />
	</ClassFactory>
</Feature>
